package com.soft.bams.cilent;

import com.soft.bams.entity.Account;
import com.soft.bams.service.Bank;

import javax.swing.*;
import java.awt.*;


/**
 * @author wangshaoshuai
 * @desc TODO
 * @date 2025/5/11
 */


public class ATMClient extends JFrame {

    //JPanel
    com.soft.bams.cilent.MainPanel mainPanel;
    com.soft.bams.cilent.LoginPanel loginPanel;
    com.soft.bams.cilent.RegisterPanel registerPanel;
    BusinessPanel businessPanel;

    //共同数据
    Bank bank;
    Account acc;

    //实例化
    public ATMClient() {
        //设置窗体的标题
        this.setTitle("ATM 取款机");
        //设置窗体的宽高
        this.setSize(480 , 650);
        //设置窗体的关闭方式  关闭即退出
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置窗体的居中显示
        this.setLocationRelativeTo(null);

        //初始化共同数据
        bank = Bank.getInstance();

        //实例化 JPanel
        mainPanel = new MainPanel(this);
        loginPanel = new LoginPanel(this);
        registerPanel = new RegisterPanel(this);
        businessPanel = new BusinessPanel(this);

        //将JPanel添加至JFrame窗体容器中，设置当前容器为卡片式布局
        Container container = this.getContentPane();
        container.setLayout(new CardLayout());
        //默认实现第一个JPanel
        container.add(mainPanel, "mainPanel");
        container.add(loginPanel, "loginPanel");
        container.add(registerPanel, "registerPanel");
        container.add(businessPanel, "businessPanel");
    }

    public static void main(String[] args) {
        new ATMClient().setVisible(true);
    }

}

